package com.stedu;

import com.stedu.controller.OwnerController;
import com.stedu.mapper.RepairMapper;
import com.stedu.utils.JwtUtil;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.HashMap;
import java.util.Map;

@SpringBootTest
public class test1 {
    @Autowired
    private RepairMapper repairMapper;
    @Autowired
    private OwnerController ownerController;
    @Test
    public void te(){
        System.out.println(ownerController.selectAll());
    }
    @Test
    public void test01(){
        Integer[] pids = {1,2,3};
        repairMapper.insertRidAndPid(2, pids);
    }
    @Test
    public void test02(){
        repairMapper.deleteRidAndPidByRid(2);
    }
    @Test
    public void test03(){
        repairMapper.selectByOname(null).forEach(System.out::println);
    }
    @Test
    public void test04(){
        HashMap<String,Object> map = new HashMap<>();
        map.put("username", "admin");
        map.put("age",20);
        map.put("quanxian",1);
        String jwtStr = JwtUtil.generateJwt(map);
        System.out.println(jwtStr);
    }
    @Test
    public void test05(){
        Map<String, Object> map = JwtUtil.parseJwtToMap("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXlsb2FkIjp7InJvb3QiOiIxIiwicGlkIjpudWxsLCJpZCI6MSwib2lkIjpudWxsLCJ1c2VybmFtZSI6ImFkbWluIn0sImV4cCI6MTcyNTU5MzkwNH0.WaB83DasW1c-UBEtQZu35efGTMTG8e0kb4hieKFXKto" );
        System.out.println(map.get("username"));
        System.out.println(map.get("password"));
        System.out.println(map.get("id"));
        System.out.println(map.get("oid"));
        System.out.println(map.get("pid"));
        System.out.println(map.get("root"));
    }
    @Test
    public static void main(String[] args){
        System.out.println("hello world");
    }
}
